﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Buy2Site.Classes
{
    public static class CartItemsManager
    {
        public static List<ProductClass> ListOfProducts { get; set; }

        public static void AddToCartList(ProductClass product)
        {
            if (product != null && !ListOfProducts.Contains(product))
                ListOfProducts.Add(product);
        }
        public static void RemoveFromCList(ProductClass product)
        {
            if (product != null)
            {
                for (int i = 0; i < ListOfProducts.Count; i++)
                {
                    if (ListOfProducts[i].Title == product.Title)
                    {
                        ListOfProducts.RemoveAt(i);
                        break;
                    }
                }
            }
        }
    }
}